#!/bin/sh
#config path
MEMCACHED_PATH=/usr/local/webserver/memcached/bin/memcached
out=`/bin/netstat -nlt | grep :11211`
if [ -n "$out" ]; then
        echo 'PORT 11211 OK !!! '`date`
else
        echo 'PORT 11211 HAS DOWN...... RESTART...... '`date`
        $MEMCACHED_PATH -d start -m 60 -p 11211 -u root -P /tmp/memcached.pid
		$MEMCACHED_PATH -d start -m 60 -p 11222 -u root -P /tmp/memcached_11222.pid
		$MEMCACHED_PATH -d start -m 60 -p 11233 -u root -P /tmp/memcached_11233.pid
		$MEMCACHED_PATH -d start -m 60 -p 11244 -u root -P /tmp/memcached_11244.pid
		$MEMCACHED_PATH -d start -m 60 -p 11255 -u root -P /tmp/memcached_11255.pid
		$MEMCACHED_PATH -d start -m 60 -p 11266 -u root -P /tmp/memcached_11266.pid
		$MEMCACHED_PATH -d start -m 60 -p 11277 -u root -P /tmp/memcached_11277.pid
		$MEMCACHED_PATH -d start -m 60 -p 11288 -u root -P /tmp/memcached_11288.pid
		$MEMCACHED_PATH -d start -m 60 -p 11299 -u root -P /tmp/memcached_11299.pid
fi
echo 'memcached restart ok ...';